package org.loong.crypto.service.core.provider;

import org.loong.crypto.common.exception.CryptoException;
import org.loong.crypto.core.algorithm.SignatureAlgorithm;
import org.loong.crypto.core.params.SignatureParameters;

/**
 * Verifier.
 */
public interface Verifier extends SignatureProvider {

    /**
     * Initialise the verifier for verification.
     * 
     * @param parameters the signature parameters.
     */
    default void init(SignatureParameters parameters) {

    }

    /**
     * Verify signature.
     * 
     * @param algorithm the algorithm
     * @param data the signing data
     * @param signature the signature value
     * @return the verify result
     * @throws CryptoException the {@link CryptoException}
     */
    boolean verify(final SignatureAlgorithm algorithm, final byte[] data, final byte[] signature) throws CryptoException;
}
